
import socket
from pylivelinkface import PyLiveLinkFace, FaceBlendShape

UDP_IP = "127.0.0.1"
UDP_PORT = 11111
py_face = PyLiveLinkFace()
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((UDP_IP, UDP_PORT))
face_object = [FaceBlendShape.EyeBlinkLeft,
FaceBlendShape.EyeLookDownLeft,
FaceBlendShape.EyeLookInLeft,
FaceBlendShape.EyeLookOutLeft,
FaceBlendShape.EyeLookUpLeft,
FaceBlendShape.EyeSquintLeft,
FaceBlendShape.EyeWideLeft,
FaceBlendShape.EyeBlinkRight,
FaceBlendShape.EyeLookDownRight,
FaceBlendShape.EyeLookInRight,
FaceBlendShape.EyeLookOutRight,
FaceBlendShape.EyeLookUpRight,
FaceBlendShape.EyeSquintRight,
FaceBlendShape.EyeWideRight,
FaceBlendShape.JawForward,
FaceBlendShape.JawLeft,
FaceBlendShape.JawRight,
FaceBlendShape.JawOpen,
FaceBlendShape.MouthClose,
FaceBlendShape.MouthFunnel,
FaceBlendShape.MouthPucker,
FaceBlendShape.MouthLeft,
FaceBlendShape.MouthRight,
FaceBlendShape.MouthSmileLeft,
FaceBlendShape.MouthSmileRight,
FaceBlendShape.MouthFrownLeft,
FaceBlendShape.MouthFrownRight,
FaceBlendShape.MouthDimpleLeft,
FaceBlendShape.MouthDimpleRight,
FaceBlendShape.MouthStretchLeft,
FaceBlendShape.MouthStretchRight,
FaceBlendShape.MouthRollLower,
FaceBlendShape.MouthRollUpper,
FaceBlendShape.MouthShrugLower,
FaceBlendShape.MouthShrugUpper,
FaceBlendShape.MouthPressLeft,
FaceBlendShape.MouthPressRight,
FaceBlendShape.MouthLowerDownLeft,
FaceBlendShape.MouthLowerDownRight,
FaceBlendShape.MouthUpperUpLeft,
FaceBlendShape.MouthUpperUpRight,
FaceBlendShape.BrowDownLeft,
FaceBlendShape.BrowDownRight,
FaceBlendShape.BrowInnerUp,
FaceBlendShape.BrowOuterUpLeft,
FaceBlendShape.BrowOuterUpRight,
FaceBlendShape.CheekPuff,
FaceBlendShape.CheekSquintLeft,
FaceBlendShape.CheekSquintRight,
FaceBlendShape.NoseSneerLeft,
FaceBlendShape.NoseSneerRight,
FaceBlendShape.TongueOut,
FaceBlendShape.HeadRoll,
FaceBlendShape.LeftEyeRoll,
FaceBlendShape.RightEyeRoll]
def send_weight(weight):
    inner_dict = dict(zip(face_object, weight))
    for each,value in inner_dict.items():
        py_face.set_blendshape(each,value)
        s.sendall(py_face.encode())

